FROM docker.m.daocloud.io/library/node:20.19.0-bullseye AS builder
WORKDIR /app

# 复制源代码 (node_modules会被.dockerignore排除)
COPY . .
RUN npm install
# 构建项目
RUN npm run build

FROM docker.m.daocloud.io/library/nginx:stable-alpine
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf

CMD ["nginx", "-g", "daemon off;"]
